#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

//int类型的柔性数组
typedef struct FlexInt {
    int N;
    int Arr[0];
}FlexInt;

void Nicochez (int *arr, int N) {
    int ret = pow(N, 3) / N - N + 1;   //求中间值
    for (int i = 0; i < N; i++) {
        arr[i] = ret + i * 2;
    }
}

int main() {
    int N = 0;
    printf("请输入数据:>");
    scanf("%d", &N);

    //开辟柔性数组
    FlexInt *arr = (FlexInt *) malloc(sizeof(FlexInt) + sizeof(int) * N);
    if (arr == NULL) {
        perror("堆区动态内存开辟失败:");
    }
    arr->N = N;

    //柔性数组的使用
    Nicochez(arr->Arr, arr->N);

    for (int i = 0; i < N; i++) {
        if (i != 0) {
            printf("+");
        }
        printf("%d", arr->Arr[i]);
    }

    //释放柔性数组
    free(arr);
    arr = NULL;
    return 0;
}